from common.readconfig import ini
from common.readelement import Element
from page.basepage import WebPage
from utils.times import sleep

index_elements = Element('index_elements')
class IndexPage(WebPage):
    def goto_app(self, name):
        """打开应用"""
        # eles = self.find_elements(index_elements['我的常用入口'])
        self.click_element(index_elements[name])
        sleep()
        self.get_url(ini.url)
        sleep()

    def entrance_add(self):
        """新增一个入口"""
        #1 点击定制按钮
        self.click_element(index_elements['定制按钮'])
        #2 添加一个入口
        self.click_element(index_elements['入口添加按钮'])
        #3 点击确定按
        self.click_element(index_elements['确定按钮'])

    def entrance_delete(self):
        """删除一个入口"""
        #1 点击定制按钮
        self.click_element(index_elements['定制按钮'])
        #2 添加一个入口
        self.click_element(index_elements['入口删除按钮'])
        #3 点击确定按
        self.click_element(index_elements['确定按钮'])